<?php

use console\db\channels\TransferTableMigration;

/**
 * 上墙数据转移
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class m300200_100041_t_activity_screen extends TransferTableMigration {

    /**
     * @inheritdoc
     */
    public $sourceDb = 'olddb';

    /**
     * @inheritdoc
     */
    public function getTransferOptions() {
        return [
            'table' => [
                'activity_screen' => 'activity_collection',
            ],
            'columns' => [
                'id',
                'activity_id' => 'actid',
                'user_id',
                'file' => function($data) {
                    $file = str_replace('https://img.lnts.cn', '', $data['file']);
                    return '/uploads/' . ltrim($file, '/');
                },
                'vote_nums',
                'like_nums',
                'status' => function($data) {
                    if ($data['status'] == 1) {
                        return 10;
                    }
                    return $data['status'];
                },
                'created_at',
                'updated_at',
                'deleted_at',
            ],
        ];
    }

}
